using System;
using System.Collections.Generic;
using System.Text;
using QuanLySim.DTO;

namespace QuanLySim.DAO
{
    class clsTenGoiDAO
    {
        #region "variable"
        private string m_strErorr;
        private clsCommand m_Command;
        #endregion

        #region "property"
        public string EORR
        {
            get { return m_strErorr; }
            set { m_strErorr = value; }
        }
        #endregion

        #region "method"
        public clsTenGoiDAO()
        {
            m_strErorr = "";
            m_Command = new clsCommand();
        }

        public bool Insert(clsTenGoiDTO TenGoiDto)
        {
            m_Command = new clsCommand();
            string strInsert = "INSERT INTO TENSIM (TENGOI) VALUES (";
            strInsert += "'" + TenGoiDto.TENGOI + "')";

            return m_Command.ExecuteNonQuery(strInsert);
        }

        public bool Delete(clsTenGoiDTO TenGoiDto)
        {
            m_Command = new clsCommand();
            string strDelete = "DELETE FROM TENSIM WHERE MATEN = ";
            strDelete += "" + TenGoiDto.MATEN + "";

            return m_Command.ExecuteNonQuery(strDelete);
        }

        public bool Update(clsTenGoiDTO TenGoiDto)
        {
            m_Command = new clsCommand();
            string strUpdate = "UPDATE TENSIM SET";
            strUpdate += " TENGOI = '" + TenGoiDto.TENGOI + "'";
            strUpdate += " WHERE MATEN = " + TenGoiDto.MATEN + "";

            return m_Command.ExecuteNonQuery(strUpdate);
        }
        #endregion
    }
}
